package com.panshi.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panshi.entity.ClassifyT;
import com.panshi.service.ClassifyTService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 分类表 前端控制器
 * </p>
 *
 * @author xhlMr
 * @since 2020-08-07
 */
@RestController
public class ClassifyTController {

    @Autowired
    private ClassifyTService classifyTService;

    @GetMapping("/classify-t/bycid/{id}")
    public ClassifyT bycid(@PathVariable("id")Integer id){
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("classify_id",id);
        return classifyTService.getOne(wrapper);
    }

    @GetMapping("/classify-t/zall")
    public List<ClassifyT> zall(){
        return classifyTService.list(null);
    }

}

